home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 273_01.zip / WRITEFN.CA < prev    next >
Text File  |  1993-04-04  |  1KB  |  61 lines

  1. #include <dos.h>
  2. writef_n(int row, int col, int attr, char *mch, int count)
  3. /* This will write of the string of characters pointed to by mch.
  4.    Writing will stop when the end of string is reached or count characters
  5.    are written.
  6. */
  7. {
  8.   extern int color, mono, cga, ega, scrseg, bios;
  9.   int   scrofs, *pattr, orow, ocol ,x;
  10.   char pchar;
  11.   char far *base;
  12.   char far *work;
  13.   if(mono) base=(char far *)0xb0000000;
  14.   else base=(char far *)0xb8000000;
  15.   if(bios) {
  16.           get_cur(&orow,&ocol);
  17.         locate(row,col) ;
  18.         while(*mch && count--) {
  19.             put_ca(*mch,attr,1);
  20.             cur_rt();
  21.             mch++;
  22.         }
  23.         locate(orow,ocol);
  24.         return(0);
  25.   }
  26.     scrofs = ((((row+1) * 160) - 160) + ((col+1) * 2)) - 2;
  27.     work = base + scrofs;
  28.     while(*mch && count--) {
  29.         pchar = *mch;
  30.         asm mov cl,pchar
  31.         asm les bx,work
  32.         if(cga) {
  33.             asm     mov    dx,03dah
  34.             asm        in    al,dx
  35.             asm        test al,1
  36.             asm        jnz $-3
  37.             asm        in    al,dx
  38.             asm        test al,1
  39.             asm        jz $-3
  40.         }
  41.             asm mov byte ptr es:[bx],cl
  42.         work++;
  43.         pchar = attr;
  44.         asm mov cl,pchar
  45.         asm les bx,work;
  46.         if(cga) {
  47.             asm     mov    dx,03dah
  48.             asm        in    al,dx
  49.             asm        test al,1
  50.             asm        jnz $-3
  51.             asm        in    al,dx
  52.             asm        test al,1
  53.             asm        jz $-3
  54.         }
  55.         asm mov byte ptr es:[bx],cl
  56.         work++;
  57.         mch++;
  58.     }
  59.   return(0);
  60. }
  61.